/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.unipar.cursoweb.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 *
 * @author Thiago Marques
 */
@Entity
public class ItensOrdemServico implements Serializable{
    
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long idItensOrdemServico;
    private BigDecimal valor;
    @ManyToOne
    @JoinColumn(name="idServico")
    private Servico servico;
    @ManyToOne
    @JoinColumn(name="idOrdemServico")
    private OrdemServico ordemServico;

    public Long getIdItensOrdemServico() {
        return idItensOrdemServico;
    }

    public void setIdItensOrdemServico(Long idItensOrdemServico) {
        this.idItensOrdemServico = idItensOrdemServico;
    }

    public OrdemServico getOrdemServico() {
        return ordemServico;
    }

    public void setOrdemServico(OrdemServico ordemServico) {
        this.ordemServico = ordemServico;
    }

    public Servico getServico() {
        return servico;
    }

    public void setServico(Servico servico) {
        this.servico = servico;
    }

    public BigDecimal getValor() {
        return valor;
    }

    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ItensOrdemServico other = (ItensOrdemServico) obj;
        if (this.idItensOrdemServico != other.idItensOrdemServico && (this.idItensOrdemServico == null || !this.idItensOrdemServico.equals(other.idItensOrdemServico))) {
            return false;
        }
        if (this.valor != other.valor && (this.valor == null || !this.valor.equals(other.valor))) {
            return false;
        }
        if (this.servico != other.servico && (this.servico == null || !this.servico.equals(other.servico))) {
            return false;
        }
        if (this.ordemServico != other.ordemServico && (this.ordemServico == null || !this.ordemServico.equals(other.ordemServico))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 53 * hash + (this.idItensOrdemServico != null ? this.idItensOrdemServico.hashCode() : 0);
        hash = 53 * hash + (this.valor != null ? this.valor.hashCode() : 0);
        hash = 53 * hash + (this.servico != null ? this.servico.hashCode() : 0);
        hash = 53 * hash + (this.ordemServico != null ? this.ordemServico.hashCode() : 0);
        return hash;
    }

    
   
}
